{% extends 'base_templates/base.html' %}
{% load static %}

{% block title %}天天生鲜-购物车{% endblock title %}
{% block search_bar %}
    <div class="search_bar clearfix">
        <a class="logo fl" href={% url 'goods:index' %}><img alt="logo" src={% static "static/images/logo.png" %}></a>
        <div class="search_con fl">
            <form action="{% url 'goods:search' 1 %}" method="post">
                {% csrf_token %}
                <label>
                    <input type="text" class="input_text fl" name="content" placeholder="搜索商品">
                </label>
                <input type="submit" class="input_btn fr" name="" value="搜索">
            </form>
        </div>
    </div>
{% endblock search_bar %}

{% block body %}
    <div class="total_count">全部商品<em>{{ total_count }}</em>件</div>
    <ul class="cart_list_th clearfix">
        <li class="col01">商品名称</li>
        <li class="col02">商品单位</li>
        <li class="col03">商品价格</li>
        <li class="col04">数量</li>
        <li class="col05">小计</li>
        <li class="col06">操作</li>
    </ul>
    <form action="{% url 'order:order' %}" method="post" id="order_form">
        {% csrf_token %}
        {% for good in goods %}
            <ul class="cart_list_td clearfix">
                <li class="col01"><input type="checkbox" name="sku_id" value="{{ good.id }}" checked></li>
                <li class="col02"><img alt="{{ good.name }}" src="{{ good.image.url }}"></li>
                <li class="col03">{{ good.name }}<br><em>{{ good.price }}元/{{ good.unite }}</em></li>
                <li class="col04">{{ good.unite }}</li>
                <li class="col05">{{ good.price }}元</li>
                <li class="col06">
                    <div class="num_add">
                        <a href="javascript:;" class="minus fl">-</a>
                        <input type="text" class="num_show fl" value="{{ good.count }}">
                        <a href="javascript:;" class="add fl">+</a>
                        <span id="goods_id" hidden="hidden">{{ good.id }}</span>
                    </div>
                </li>
                <li class="col07">{{ good.amount }}元</li>
                <li class="col08"><a href="javascript:;">删除</a></li>
            </ul>
        {% endfor %}
    </form>
    <ul class="settlements">
        <li class="col01"><input type="checkbox" name="" checked=""></li>
        <li class="col02">全选</li>
        <li class="col03">合计(不含运费)：<span>¥</span><em>{{ total_price }}</em><br>共计<b>{{ total_count }}</b>件商品
        </li>
        <li class="col04"><a href="javascript:;" onclick="$('#order_form').submit()">去结算</a></li>
    </ul>
    {% csrf_token %}
    <script type="text/javascript" src="{% static 'static/js/jquery-1.12.4.min.js' %}"></script>
    <script type="text/javascript" src="{% static 'static/js/cart.js' %}"></script>
{% endblock body %}
